package mysql

import "hr/models"

func CheckUserExist(username string) (bool, error) {
	sqlstr := `select count(user_id) from user where username =?`
	var count int
	if err := db.Get(&count, sqlstr, username); err != nil {
		return false, err
	}
	return true, nil
}
func InsertUser(u *models.User) (err error) {
	sqlStr := `insert into user(user_id,username,password) values (?,?,?)`
	_, err = db.Exec(sqlStr, u.UserId, u.UserName, u.Password)
	return err
}
